package com.alkaid.commons.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotNull;

/**
 * @author Kylin
 */

@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class AnimePageEntity extends PageEntity {
    @NotNull(message = "分页参数sort错误")
    @Range(min = 0, max = 9, message = "分页参数sort错误")
    private Integer sort;

    public String getOrderBy () {
        switch (sort) {
            case 0: return "collect_num desc";
            case 1: return "collect_num asc";
            case 2: return "refresh_time desc";
            case 3: return "refresh_time asc";
            case 4: return "score desc";
            case 5: return "score asc";
            case 6: return "count desc";
            case 7: return "count asc";
            case 8: return "start_time desc";
            case 9: return "start_time asc";
            default: return null;
        }
    }

    public String getSql() {
        return "";
    }
}
